import store from "./store/index";

App({
  onLaunch: function () {
    const token = wx.getStorageSync('token');
    const openid=wx.getStorageSync('openid')
    const infouser=wx.getStorageSync('infouser')
    const session_key=wx.getStorageSync('session_key')
    if (token) {
      store.data.isToken=token; // 假设 store 提供了 setToken 方法 
    }
    if(infouser){
      store.data.infouser=infouser
    }
    if(openid){
      store.data.openid=openid
    }
    if(session_key){
      store.data.session_key=session_key
    }
    this.checkTokenAndNavigate();
  },
  onShow: function () {
    this.checkTokenAndNavigate();
    console.log('App Show');
  },
  onHide: function () {
    this.checkTokenAndNavigate();
  },
  onError: function (msg) {
    console.error('App Error:', msg);
  },
  checkTokenAndNavigate: function () {
    
  },
  globalData: {
    userInfo: null,
    isToken:null,

  },
  store: store
});